#pragma once

#include "vector2.h"
#include "transformable.h"




namespace math
{
   template
   <
      typename float_t
   >
   class Particle : public transformable<float_t>
   {
   private:

      /// The velocity of the particle
      vector3_t       m_velocity;

      /// The mass of the particle, defaults to 1
      const float_t   m_mass;

      /// The age of the particle in seconds
      float_t         m_age;

      /// The lifetime of the particle on seconds
      float_t         m_lifetime;

   public:

      Particle(const vector3_t& position, const vector3_t& velocity, float lifetime, float mass = 1)
         : transformable(matrix4x4_t(position, matrix3x3_t()))
         , m_velocity(velocity)
         , m_age(0)
         , m_lifetime(0)
         , m_mass(mass)
      {}



      /**
       * Get the current velocity of the particle.
       */
      vector3_t& velocity()
      {
         return m_velocity;
      }

      /**
       * Get the current velocity of the particle.
       */
      const vector3_t& velocity() const
      {
         return m_velocity;
      }



      /**
       * Get the mass of the particle
       */
      float_t mass() const
      {
         return m_mass;
      }



      /**
       * Get the lifetime of the particle.
       * Defines how many seconds this particle has still to live.
       */
      float_t lifetime() const
      {
         return m_lifetime;
      }

      /**
       * Set the lifetime of the particle.
       */
      void setLifetime(float_t lifetime)
      {
         m_lifetime = lifetime;
      }

      /**
       * Get the age of the particle.
       * Defines how many seconds this particle has lived already.
       * A newly created particle has an age of 0.
       */
      float_t age() const
      {
         return m_age;
      }
   };
   ///////////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////////////////
